class Solution {
    public boolean isPalindrome(String s) {
        int l=0;
        int r=s.length()-1;
        while(l<=r)
        {
            while(l<r&&!isLetterOrDigit(s.charAt(l)))
            {
                l++;
            }
            while(l<r&&!isLetterOrDigit(s.charAt(r)))
            {
                r--;
            }
            if(AToa(s.charAt(l))!=AToa(s.charAt(r)))
            return false;
            l++;
            r--;
        }
        return true;
    }
    public boolean isLetterOrDigit(char temp){
    if(temp >= '0' && temp <= '9'||temp >= 'a' && temp <= 'z'||temp >= 'A' && temp <= 'Z')
    return true;
    else
    return false;
    }
    public char AToa(char temp ){
        if(temp >= 'A' && temp <= 'Z'){
            return temp+=32;
        }else{
            return temp;
        }
    }
}

